<form name="editForm" role="form" novalidate (ngSubmit)="save()" #editForm="ngForm">

    <div class="modal-header">
        <h4 class="modal-title" id="myCompanyLabel" jhiTranslate="personApp.company.home.createOrEditLabel">Create or edit a Company</h4>
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true"
                (click)="clear()">&times;</button>
    </div>
    <div class="modal-body">
        <jhi-alert-error></jhi-alert-error>
        <div class="form-group" [hidden]="!company.id">
            <label for="id" jhiTranslate="global.field.id">ID</label>
            <input type="text" class="form-control" id="id" name="id"
                   [(ngModel)]="company.id" readonly />
        </div>
        <div class="form-group">
            <label class="form-control-label" jhiTranslate="personApp.company.name" for="field_name">Name</label>
            <input type="text" class="form-control" name="name" id="field_name"
                [(ngModel)]="company.name"  />
        </div>
        <div class="form-group">
            <label class="form-control-label" jhiTranslate="personApp.company.address" for="field_address">Address</label>
            <input type="text" class="form-control" name="address" id="field_address"
                [(ngModel)]="company.address"  />
        </div>
        <div class="form-group">
            <label class="form-control-label" jhiTranslate="personApp.company.phone" for="field_phone">Phone</label>
            <input type="text" class="form-control" name="phone" id="field_phone"
                [(ngModel)]="company.phone"  />
        </div>

        <div class="form-group">
            <label jhiTranslate="personApp.company.department" for="field_department">Department</label>
            <select class="form-control" id="field_department" multiple name="department" [(ngModel)]="company.departments">
                <option [ngValue]="getSelected(company.departments, departmentOption)" *ngFor="let departmentOption of departments; trackBy: trackDepartmentById">{{departmentOption.name}}</option>
            </select>
        </div>
    </div>
    <div class="modal-footer">
        <button type="button" class="btn btn-secondary" data-dismiss="modal" (click)="clear()">
            <span class="fa fa-ban"></span>&nbsp;<span jhiTranslate="entity.action.cancel">Cancel</span>
        </button>
        <button type="submit" [disabled]="editForm.form.invalid || isSaving" class="btn btn-primary">
            <span class="fa fa-save"></span>&nbsp;<span jhiTranslate="entity.action.save">Save</span>
        </button>
    </div>
</form>
